

const express = require('express')
const path = require('path')
const app = express()

// 设置模板引擎
app.set('view engine','ejs')
// 设置路径
// app.set('views' ,path.join(__dirname,'views'))

app.get('/ejs',(req,res)=>{
    // ejs 模板引擎,默认渲染，views文件夹下的文件
    res.render('index',{
        msg:'你好',
        stus:[
            {id:0,name:'张三1',gender:'1',age:18,hobbies:'ssss'},
            {id:1,name:'张三2',gender:'1',age:18,hobbies:'ssss'},
            {id:2,name:'张三3',gender:'1',age:18,hobbies:'ssss'},
            {id:3,name:'张三4',gender:'1',age:18,hobbies:'ssss'}
        ],
        msg2:'hello'
    })
})


app.listen(3000,()=>{
    console.log(`服务已启动`);
})